﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default1.aspx.cs" Inherits="BG.Web.Admin.Default1" %>
<%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>
<html>
<head runat="server">
    <title></title>
    <link rel="Stylesheet" href="resources/Kwan.Base.css" />
    <link rel="Stylesheet" href="resources/Kwan.icon.css" />
</head>
<body>
    <script type="text/javascript" src="Kwan.tab.js"></script>
    <ext:ResourceManager ID="ResourceManager1" runat="server" DirectMethodNamespace="Default" />

    <ext:Store ID="Store1" runat="server">        
        <Reader>
            <ext:JsonReader>
                <Fields>
                    <ext:RecordField Name="Title" />
                    <ext:RecordField Name="Items" IsComplex="true" />
                </Fields>
            </ext:JsonReader>
        </Reader>
    </ext:Store>

    <ext:Store ID="roomStore" OnRefreshData="RefreshRoomDS" runat="server">        
        <Reader>
            <ext:JsonReader>
                <Fields>
                    <ext:RecordField Name="Title" />
                    <ext:RecordField Name="Items" IsComplex="true" />
                </Fields>
            </ext:JsonReader>
        </Reader>
    </ext:Store>

    <ext:Viewport runat="server" Layout="Border">
        <Items>
            <ext:Panel runat="server" Region="North" Height="58" BodyBorder="False" BodyCssClass="header" Layout="Column" Padding="14">
                <Items>
                    <ext:Container runat="server" Width="180">
                        <Items>
                            <ext:ImageButton ID="btnLogo" runat="server" ImageUrl="resources/images/Expro.png" />
                        </Items>
                    </ext:Container>
                    <ext:Container runat="server" ColumnWidth=".7" Layout="HBoxLayout">
                        <Items>
                            <ext:Label runat="server" Flex="1"/>
                            <ext:Button ID="btnLoginUser" runat="server" Icon="UserSuitBlack" Margins="0 3" Height="30" />
                            <ext:Button ID="btnRefreshPage" runat="server" Icon="ArrowRefresh" Text="刷新当前页" Margins="0 3" Height="30">
                                <Listeners>
                                    <Click Handler="#{TabPanel1}.getActiveTab().reload(true);" />
                                </Listeners>
                            </ext:Button>
                            <ext:Button ID="btnSetDefault" runat="server" Icon="AsteriskOrange" Text="设为常用页" Margins="0 3" Disabled="True" Height="30" />
                            <ext:Button ID="btnEditPassword" runat="server" Icon="ShieldSilver" Text="修改密码" Margins="0 3" Height="30">
                                <DirectEvents>
                                    <Click OnEvent="BtnEditPassword_Click" />
                                </DirectEvents>
                            </ext:Button>
                            <ext:Button ID="BtnLogout" runat="server" Icon="LockGo" Text="注销登录" Margins="0 3" Height="30">
                                <DirectEvents>
                                    <Click OnEvent="BtnLogout_Click" />
                                </DirectEvents>
                            </ext:Button>
                            <ext:ComboBox ID="cmbTheme" Editable="false" EmptyText=" 更换主题.." runat="server" Width="100" Margins="4 3">
                                <Items>
                                    <ext:ListItem Text="blue" />
                                    <ext:ListItem Text="gray" />
                                    <ext:ListItem Text="slate" />
                                </Items>
                                <Listeners>
                                    <Select Handler="Ext.net.ResourceMgr.setTheme('/extjs/resources/css/xtheme-'+this.getValue()+'-embedded-css/ext.axd', this.getValue());" />
                                </Listeners>
                            </ext:ComboBox>
                        </Items>
                    </ext:Container>
                </Items>
                <%--<Content>
                    <div id="header">
                        <div class="header-logo">
                            <a href="http://www.yj-star.com/" target="_blank"><img src="resources/images/ext_net_badge.gif"></a>
                        </div>
                        <div class="header-user">
                            <ext:ComboBox ID="cbTheme" EmptyText=" 更改主题.." runat="server">
                                <Items>
                                    <ext:ListItem Text="Blue" />
                                    <ext:ListItem Text="Gray" />
                                    <ext:ListItem Text="Slate" />
                                </Items>
                            </ext:ComboBox>
                            
                        </div>
                    </div>
                </Content>--%>
            </ext:Panel>
            <ext:Panel runat="server" Region="West" Title="控制面板" Layout="Row" Width="200" Collapsible="true" Margins="0 1 5 2" BodyStyle="border-left:none;border-right:none;border-bottom:none;" Icon="ApplicationForm">
            <Items>
                <ext:Panel ID="ControlPanel" BodyBorder="false" runat="server" Layout="accordion" RowHeight=".7" Width="200" MaxWidth="400">
                    <Items>
                      <%--<ext:MenuPanel ID="MenuPanel1" Title="常用功能" runat="server">
                        <Menu ID="Menu1" runat="server">
                            <Items>
                                <ext:MenuItem ID="base_item" runat="server" Text="基本配置" Icon="Report">
                                    <CustomConfig>
                                        <ext:ConfigItem Name="url" Value="/Admin/pages/article/article_crud.aspx" Mode="Value" />
                                    </CustomConfig>
                                </ext:MenuItem>
                                    
                                <ext:MenuSeparator />
                                    
                                <ext:MenuItem ID="article_item" runat="server" Text="新闻管理" Icon="Report">
                                    <Menu>
                                        <ext:Menu ID="Menu2" runat="server">
                                            <Items>
                                                <ext:MenuItem ID="MenuItem1"  runat="server" Text="备份帐套" Icon="DatabaseSave">
                                                    <Listeners>
                                                        <Click Handler="JavaScript:window.open('#');" />
                                                    </Listeners>
                                                </ext:MenuItem>
                                                <ext:MenuItem ID="MenuItem2" runat="server" Text="恢复帐套" Icon="DatabaseGo">
                                                    <Listeners>
                                                        <Click Handler="JavaScript:window.open('#');" />
                                                    </Listeners>
                                                </ext:MenuItem>
                                            </Items>
                                        </ext:Menu>
                                    </Menu>
                                    <CustomConfig>
                                        <ext:ConfigItem Name="url" Value="/Ext.Net/article/Default.aspx" Mode="Value" />
                                    </CustomConfig>
                                </ext:MenuItem>
                                    
                                <ext:MenuSeparator />
                                    
                                <ext:MenuItem ID="job_item" runat="server" Text="职位管理" Icon="Report">
                                    <CustomConfig>
                                        <ext:ConfigItem Name="url" Value="/Ext.Net/job/Default.aspx" Mode="Value" />
                                    </CustomConfig>
                                </ext:MenuItem>

                                <ext:MenuSeparator />

                                <ext:MenuItem ID="user_item" runat="server" Text="用户管理" Icon="Report">
                                    <CustomConfig>
                                        <ext:ConfigItem Name="url" Value="/Ext.Net/User/Default.aspx" Mode="Value" />
                                    </CustomConfig>
                                </ext:MenuItem>
                            </Items>
                            <Listeners>
                                <ItemClick Handler="Kwan.addTab({ tabPanel: #{TabPanel1}, id: menuItem.id, title: menuItem.text,icon: menuItem.icon, url: menuItem.url, icon: menuItem.iconCls});" />
                            </Listeners>
                        </Menu>
                    </ext:MenuPanel>--%>
                    </Items>
                </ext:Panel>
                <ext:Panel runat="server" Height="10" BodyBorder="false"></ext:Panel>
                <ext:Panel ID="MessagePanel" runat="server" Title="系统信息" RowHeight=".3" Width="200" MaxWidth="400" BodyStyle="background-color:#F0F0F0;font-size:12px;padding:10px;" Icon="ApplicationHome">
                    <Content>
                        <%--欢迎使用本系统，如果您碰到问题，可以咨询 <a href='http://www.yj-star.com' target='_blank'>我们</a>，我们将尽最大的努力帮助您。 <br /><br /><p> 非常感谢您的支持<p><br /><p>tel:13326588347</p>--%>
                        <% System.Diagnostics.Process process = System.Diagnostics.Process.GetCurrentProcess(); %>
                        <p>ASP.Net 内存：<%= ((System.Double)process.WorkingSet64 / 1048576).ToString("N2") + "M"%></p>
                        <p>当前占用：<%= ((System.Double)System.GC.GetTotalMemory(false) / 1048576).ToString("n2") + "M"%></p>
                        <p>ASP.Net CPU：<%= ((System.TimeSpan)process.TotalProcessorTime).TotalSeconds.ToString("N2")%>秒</p>
                        <p>启动于：<%= process.StartTime%></p>
                        <p>Session数：<%= Session.Contents.Count%>，<%= Session.Timeout%>分钟</p>
                        <p>Cache数：<%= Cache.Count%></p>
                    </Content>
                </ext:Panel>
            </Items>
            </ext:Panel>
            <ext:TabPanel ID="TabPanel1" runat="server" Region="Center" EnableTabScroll="true" Margins="0 3 5 3">
                <Items>
                    <ext:Panel ID="DashBoardPanel" runat="server" Cls="items-view" Icon="House" Title=" 欢迎 " AutoHeight="true" Layout="Fit">
                        <TopBar>
                            <ext:Toolbar runat="server" Flat="true">
                                <Items>
                                    <ext:ToolbarFill />
                                    <ext:Button runat="server" Icon="BulletPlus" Text="展开所有">
                                        <Listeners>
                                            <Click Handler="#{Dashboard}.el.select('.group-header').removeClass('collapsed');" />
                                        </Listeners>
                                    </ext:Button>
                        
                                    <ext:Button runat="server" Icon="BulletMinus" Text="关闭所有">
                                            <Listeners>
                                            <Click Handler="#{Dashboard}.el.select('.group-header').addClass('collapsed');" />
                                        </Listeners>
                                    </ext:Button>
                                    <ext:ToolbarSpacer runat="server" Width="30" />
                                </Items>
                            </ext:Toolbar>
                        </TopBar>
                        <Items>
                            <%--<ext:Panel ID="SystemInfo" runat="server" Cls="items-view" Layout="fit" AutoHeight="true" Border="false" PaddingSummary="15 25" Hidden="true">
                            <Content>
                                <table cellpadding="3" cellspacing="1" border="0" width="100%" align="center" class="systeminfo">
                                    <tr>
                                      <td height=25 class="td_title">本系统由 阳江示达科技有限公司 授权给 <font color="#FF0000">某公司</font> 使用，当前使用版本为 V1.0</td>
                                    </tr>
                                    <tr><td height=23 style="padding-left: 20px">
                                        系统信息：
                                        | 商品总数 <b>0</b> 分类总数:<b>0</b>
                                        | 新闻总数 <b>0</b> 分类总数:<b>0</b>
                                        | 订单信息 <b>0</b>

                                        | 留言总数 <b>0</b>
                                        | 友情连接 <b>0</b>

                                        | 会员数量 <b>0</b>
                                        | 广告图片 <b>0</b>
                                    </td></tr>
                                </table>
                            </Content>
                            </ext:Panel>--%>
                            <ext:DataView ID="Dashboard" runat="server" StoreID="Store1" SingleSelect="true" OverClass="x-view-over" ItemSelector="div.item-wrap" AutoHeight="true" EmptyText="No items to display">
                                <Template runat="server">
                                    <Html>
							            <div id="items-ct">
								            <tpl for=".">
									            <div class="group-header">
										            <h2><div>{Title}</div></h2>
										            <dl>
											            <tpl for="Items">
												            <div id="{Id}" title="{Title}" class="item-wrap">
													            <img src="{Icon}"/>
													            <div><H6>{Title}</H6></div>
												            </div>
											            </tpl>
											            <div style="clear:left"></div>
										            </dl>
									            </div>
								            </tpl>
                                            <div class="group-header">
										        <h2><div>信息统计</div></h2>
										        <dl>
												    <div class="item-lable">剩余房间：12 间</div>
											        <div style="clear:left"></div>
										        </dl>
									        </div>
							            </div>
						            </Html>
                                </Template>
                                <Listeners>
                                    <SelectionChange Fn="Kwan.selectionChanged" />
                                    <ContainerClick Fn="Kwan.viewClick" />
                                </Listeners>
                            </ext:DataView>
                        </Items>
                    </ext:Panel>
                </Items>
                <Plugins>
                    <ext:TabCloseMenu runat="server" CloseTabText="关闭标签" CloseOtherTabsText="关闭其他" CloseAllTabsText="全部关闭" />
                </Plugins>
            </ext:TabPanel>

            <ext:Panel Region="East" Width="150" Margins="0 5 5 1" Padding="36" Collapsible="true" ID="EastPanel" runat="server" Icon="Heart" Title="常规操作" Layout="VBoxLayout">
                <Defaults>
                    <ext:Parameter Name="margins" Value="0 0 20 0" Mode="Value" />
                </Defaults>
                <Items>
                    <ext:Button ID="btnSearchRoom" runat="server" Text="查找房间" IconCls="Kwan-icon-room-32" IconAlign="Top">
                        <Listeners>
                            <Click Handler="roomStore.reload();" />
                        </Listeners>
                    </ext:Button>
                    <ext:Button ID="btnCheckOut" runat="server" Text="结 账" IconCls="Kwan-icon-checkout" IconAlign="Top">
                        <DirectEvents>
                            <Click OnEvent="btnCheckOut_Click" Failure="Ext.MessageBox.alert('系统提示', response.statusText);">
                                <EventMask Target="CustomTarget" CustomTarget="={#{winCheckIN}.body}" ShowMask="True" />
                            </Click>
                        </DirectEvents>
                    </ext:Button>
                </Items>
            </ext:Panel>
                       		
            <%--<ext:Panel runat="server" Title="South" Region="South" Collapsible="true" Height="40" Padding="6" Html="South" Header="False" />--%>
        </Items>
    </ext:Viewport>

    <%--密码窗体--%>
    <ext:Window ID="winPassword" runat="server" Icon="Group" Title="修改密码" Width="400" Height="200" AutoShow="false" Modal="true" Collapsible="true" Hidden="true" Layout="Fit" LabelWidth="70" AnimateTarget="btnEditPassword">
        <Items>
            <ext:FormPanel ID="fpPassword" MonitorValid="true" runat="server" Header="false" Icon="ChartOrganisation" Padding="5" Layout="Form" LabelAlign="Right" LabelWidth="70" MonitorResize="true">
                <Items>
                    <ext:Hidden ID="txtUserID" runat="server" />
                    <ext:TextField ID="txtUserName" ReadOnly="true" FieldLabel="用户名" AnchorHorizontal="90%" runat="server" AllowBlank="false" />
                    <ext:TextField ID="txtOldPassword" runat="server" InputType="Password" FieldLabel="旧密码" MinLength="6" AnchorHorizontal="90%" AllowBlank="false" />
                    <ext:TextField ID="txtNewPassword" InputType="Password" FieldLabel="新密码" MinLength="6" AnchorHorizontal="90%" runat="server" AllowBlank="false" />
                    <ext:TextField ID="txtVPassword" InputType="Password" Vtype="password" MsgTarget="Side" FieldLabel="确认新密码" MinLength="6" AnchorHorizontal="90%" AllowBlank="false" runat="server" VtypeText="与新密码不一致">
                    <CustomConfig>
                        <ext:ConfigItem Name="initialPassField" Value="#{txtNewPassword}" Mode="Value" />
                    </CustomConfig>
                    </ext:TextField>
                </Items>
                <Buttons>
                    <ext:Button ID="SaveButton" runat="server" Icon="Disk" Text="确认">
                        <DirectEvents>
                            <Click OnEvent="SavePasswordWindow" Failure="Ext.MessageBox.alert('系统提示', response.statusText);">
                                <EventMask Target="CustomTarget" CustomTarget="={#{winPassword}.body}" ShowMask="True" />
                            </Click>
                        </DirectEvents>
                    </ext:Button>
                    <ext:Button ID="CancelButton" runat="server" Text="返回" Icon="Cancel">
                        <Listeners>
                            <Click Handler="#{winPassword}.hide();" />
                        </Listeners>
                    </ext:Button>
                </Buttons>
            </ext:FormPanel>
        </Items>
    </ext:Window>

    <%--入住/退房 窗体--%>
    <ext:Window ID="winCheckIN" runat="server" Icon="Group" Title="登记入住" Width="600" Height="450" AutoShow="false" Modal="true" Collapsible="true" Hidden="true" Layout="Fit" LabelWidth="70" AnimateTarget="btnCheckIN">
        <Items>
            <ext:FormPanel ID="fpCheckIN" MonitorValid="true" runat="server" Header="false" Icon="ChartOrganisation" Padding="5" Layout="Form" LabelAlign="Right" LabelWidth="70" MonitorResize="true">
                <Items>
                    <ext:FieldSet runat="server" Padding="10" Layout="form">
                    <Items>
                    <ext:Hidden ID="txtRoomID" runat="server" />
                    <ext:Hidden ID="txtPrice" runat="server" /><%--房费--%>
                    <ext:Hidden ID="txtDisCount" runat="server" />
                    <ext:Label runat="server" ID="lblRoomNO" Cls="font16" AnchorHorizontal="100%" />
                    <ext:Container runat="server" Layout="Column" Height="30" AnchorHorizontal="99%">
                    <Items>
                    <ext:Container runat="server" LabelAlign="Left" Layout="Form" ColumnWidth=".5">
                    <Items>
                        <ext:Label ID="txtCardNo" ReadOnly="true" FieldLabel="卡号" AnchorHorizontal="98%" runat="server" AllowBlank="false" />
                        <ext:Label ID="txtBuildNo" FieldLabel="楼号" AnchorHorizontal="98%" AllowBlank="false" runat="server" ReadOnly="true" Hidden="true" />
                        <ext:Label ID="txtEndDate" FieldLabel="有效期" AnchorHorizontal="98%" runat="server" ReadOnly="true" Hidden="true" />
                    </Items>
                    </ext:Container>
                    <ext:Container runat="server" LabelAlign="Left" Layout="Form" ColumnWidth=".5">
                    <Items>
                        <ext:Label ID="txtFloorNo" FieldLabel="层号" AnchorHorizontal="98%" AllowBlank="false" runat="server" ReadOnly="true" />
                    </Items>
                    </ext:Container>
                    </Items>
                    </ext:Container>
                    </Items>
                    </ext:FieldSet>
                    <ext:Container runat="server" Layout="Column" Height="135" AnchorHorizontal="99%">
                    <Items>
                    <ext:Container runat="server" LabelAlign="Left" Layout="Form" ColumnWidth=".5">
                    <Items>
                        <ext:SpinnerField ID="txtDays" FieldLabel="入住天数" AnchorHorizontal="98%" AllowBlank="false" runat="server" MinValue="1">
                        <Listeners>
                            <Spin Handler="Kwan.changeTotalPrice(#{txtIsDisCount}.checked);" />
                        </Listeners>
                        </ext:SpinnerField>
                        <ext:NumberField ID="txtDeposit" FieldLabel="入住押金" AnchorHorizontal="98%" runat="server" />
                        <ext:NumberField ID="txtOtherPrice" FieldLabel="其他费用" AnchorHorizontal="98%" runat="server" />
                        <ext:NumberField ID="txtTotalPrice" FieldLabel="房费" AnchorHorizontal="98%" runat="server" ReadOnly="True" />
                        <ext:Checkbox ID="txtIsDisCount" FieldLabel="选项" BoxLabel="享受优惠" runat="server">
                            <Listeners>
                                <Check Handler="Kwan.changeTotalPrice(this.checked)" />
                            </Listeners>
                        </ext:Checkbox>
                    </Items>
                    </ext:Container>
                    <ext:Container runat="server" LabelAlign="Left" Layout="Form" ColumnWidth=".5">
                    <Items>
                        <ext:TextField ID="txtCustomerName" FieldLabel="姓名" AnchorHorizontal="98%" runat="server" />
                        <ext:TextField ID="txtAddress" FieldLabel="地址" AnchorHorizontal="98%" runat="server" />
                        <ext:NumberField ID="txtIdentityNO" runat="server" FieldLabel="证件号码" MinLength="6" AnchorHorizontal="98%" />
                        <ext:TextField ID="txtMemo" FieldLabel="备注" AnchorHorizontal="98%" runat="server" />
                    </Items>
                    </ext:Container>
                    </Items>
                    </ext:Container>
                </Items>
                <Buttons>
                    <ext:Button ID="btnReadCard" runat="server" Text="读卡" Icon="PictureEmpty">
                        <Listeners>
                            <Click Handler="Default.RoomClick(#{txtRoomID}.getValue());" />
                        </Listeners>
                    </ext:Button>
                    <ext:Button ID="btnSaveCheckOut" runat="server" Icon="DoorOut" Text="结账">
                        <DirectEvents>
                            <Click OnEvent="btnSaveCheckOut_Click" Failure="Ext.MessageBox.alert('系统提示', response.statusText);">
                                <EventMask Target="CustomTarget" CustomTarget="={#{winCheckIN}.body}" ShowMask="True" />
                            </Click>
                        </DirectEvents>
                    </ext:Button>
                    <ext:Button ID="btnSaveCheckIN" runat="server" Icon="DoorIn" Text="登记入住">
                        <DirectEvents>
                            <Click OnEvent="btnSaveCheckIN_Click" Failure="Ext.MessageBox.alert('系统提示', response.statusText);">
                                <EventMask Target="CustomTarget" CustomTarget="={#{winCheckIN}.body}" ShowMask="True" />
                            </Click>
                        </DirectEvents>
                    </ext:Button>
                    <ext:Button ID="btnCancel" runat="server" Text="返回" Icon="Cancel">
                        <Listeners>
                            <Click Handler="#{winCheckIN}.hide();" />
                        </Listeners>
                    </ext:Button>
                </Buttons>
            </ext:FormPanel>
        </Items>
    </ext:Window>

    <%--房间窗体--%>
    <ext:Window ID="winRooms" runat="server" Icon="Group" Title="所有空闲房间" Width="1000" Height="550" AutoShow="false" Modal="true" Collapsible="true" Hidden="true" LabelWidth="70" AnimateTarget="btnSearchRoom" AutoScroll="True" BodyStyle="background-color:#FFF;" Maximizable="true">
        <Items>
            <ext:Panel ID="Panel1" runat="server" Cls="items-view" Layout="fit" AutoHeight="true" Border="false">
            <TopBar>
                <ext:Toolbar runat="server" Flat="true">
                    <Items>
                        <ext:ToolbarFill />
                        <ext:Button ID="Button2" runat="server" Icon="BulletPlus" Text="展开所有">
                            <Listeners>
                                <Click Handler="#{dvRoom}.el.select('.group-header').removeClass('collapsed');" />
                            </Listeners>
                        </ext:Button>
                        
                        <ext:Button ID="Button3" runat="server" Icon="BulletMinus" Text="关闭所有">
                                <Listeners>
                                <Click Handler="#{dvRoom}.el.select('.group-header').addClass('collapsed');" />
                            </Listeners>
                        </ext:Button>
                        <ext:ToolbarSpacer runat="server" Width="30" />
                    </Items>
                </ext:Toolbar>
            </TopBar>
            <Items>
            <ext:DataView ID="dvRoom" runat="server" StoreID="roomStore" SingleSelect="true" OverClass="x-view-over" ItemSelector="div.item-wrap" AutoHeight="true" EmptyText="<div style='width:100px;margin:200px 480px;font-size:14px;color:red;font-weight:700;'>没房间了！</div>">
                <Template ID="Template2" runat="server">
                    <Html>
						<div id="items-ct">
							<tpl for=".">
								<div class="group-header">
									<h2><div>{Title}</div></h2>
									<dl>
										<tpl for="Items">
											<div id="{Id}" title="{Title}" class="item-wrap item-wrap-room">
												<img src="{Icon}"/>
												<div>
													<H6>{Title}</H6>                                                													            </div>
											</div>
										</tpl>
										<div style="clear:left"></div>
										</dl>
								</div>
							</tpl>
						</div>
					</Html>
                </Template>
                <Listeners>
                    <SelectionChange Fn="Kwan.controlClick" />
                    <ContainerClick Fn="Kwan.viewClick" />
                </Listeners>
            </ext:DataView>
            </Items>
            </ext:Panel>
        </Items>
    </ext:Window>
</body>
</html>
